using System;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Contexts;
using System.Security.Permissions;

namespace MSTestExtensions
{
    /// <remarks />
    [AttributeUsage(AttributeTargets.Class)]
    public sealed class MSTestExtensionsTestAttribute : ContextAttribute
    {
        #region Constructors

        /// <remarks />
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        public MSTestExtensionsTestAttribute()
            : base("MSTestExtensionsTest")
        {
        }

        #endregion // Constructors

        #region Methods

        /// <remarks />
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        public override void GetPropertiesForNewContext(IConstructionCallMessage msg)
        {
            if (msg == null)
                throw new ArgumentNullException("msg");
            msg.ContextProperties.Add(new TestProperty<TestTimerAspect>());
            msg.ContextProperties.Add(new TestProperty<TestTransactionAspect>());
            msg.ContextProperties.Add(new TestProperty<ExpectedExceptionMessageAspect>());
        }

        #endregion // Methods
    }
}
